#!/usr/bin/env python
# encoding: utf-8
'''
@author: Excelsiorly
@license: (C) Copyright 2021, All Rights Reserved.
@contact: excelsiorly@qq.com
@file: 0031.py
@time: 2021/11/9 15:36
@desc:
'''


class Solution:
    def isStraight(self, nums: list) -> bool:
        n = len(nums)
        nums_set = set(nums)
        _nums = list(nums_set)
        _nums.sort()

        # 找出第一个非0的位置
        index = 0
        for i in range(n):
            if not _nums[i] == 0:
                index = i
                break

        # 找出最大值与最小值的差值
        if _nums[-1] - _nums[index] < n:
            return True

        return False

if __name__ == '__main__':
    nums = [0,0,1,2,5]
    res = Solution().isStraight(nums)
    print(res)